package io.vanaheimr.account;

import io.micronaut.core.annotation.Introspected;
import io.vanaheimr.common.db.BaseEntity;
import jakarta.persistence.*;
import lombok.*;

import java.util.List;

@Entity
@Getter
@Setter
@NoArgsConstructor
@Introspected
@ToString
public class Role extends BaseEntity {

    private String name;

    private String remark;

    @ManyToMany
    @JoinColumn(name = "user_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    @ToString.Exclude
    private List<Account> users;

    @ManyToMany
    @JoinColumn(name = "resource_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    @ToString.Exclude
    private List<Resource> resources;
}
